using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms ;

using LanguageInfo.BLL;
using LanguageInfo.Entity;
using LanguageInfo.Common.Enum;
using LanguageInfo.Common.Utilities;

namespace LanguageInfo.Forms
{
    public partial class Form_Login : Form
    {
        public Form_Login()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            MainForm mainFrm = new MainForm();
            this.Hide();
            mainFrm.ShowDialog();
            this.Close();
            //bool isSuccess = false;
            //switch (UserInfoBLL.ValidatedLogin(this.textBox_UserName.Text, this.textBox_Password.Text))
            //{
            //    case UserInfoBLL.LoginResult.NoUser:
            //        System.Windows.Forms.MessageBox.Show("User Login Name Is Space .");
            //        this.textBox_UserName.Focus();
            //        this.textBox_UserName.SelectAll();
            //        break;
            //    case UserInfoBLL.LoginResult.NoPassword:
            //        System.Windows.Forms.MessageBox.Show("User Login Password Is Space .");
            //        this.textBox_Password.Focus();
            //        this.textBox_Password.SelectAll();
            //        break;
            //    case UserInfoBLL.LoginResult.UserOrPasswordError:
            //        System.Windows.Forms.MessageBox.Show("User Name or Password is Error .");
            //        this.textBox_UserName.Text="";
            //        this.textBox_Password.Text="";
            //        this.textBox_UserName.Focus();
            //        this.textBox_UserName.SelectAll();
            //        break;
            //    case UserInfoBLL.LoginResult.Success:
            //        isSuccess = true;
            //        break;
            //}
            //if (isSuccess)
            //{
            //    this.DialogResult = DialogResult.OK;
            //}
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Closed();
        }

        private void Form_Login_FormClosed(object sender, FormClosedEventArgs e)
        {
            Closed();
        }

        private new void Closed()
        {
            this.Dispose();
            GC.Collect();
        }

    }
}